home *** CD-ROM | disk | FTP | other *** search
- Frequently Asked Questions (FAQS);faqs.471
-
-
-
- 3) When Tim was one year old, Mary was three years older than Tim will be when
- Jane is three times as old as Mary was six years before the time when Jane
- was half as old as Tim will be when Mary will be ten years older than Mary
- was when Jane was one-third as old as Tim will be when Mary will be three
- times as old as she was when Jane was born.
-
- HOW OLD ARE THEY NOW?
-
- ==> logic/ages.s <==
- The solution: Tim is 3, Jane is 8, and Mary is 15. A little grumbling
- is in order here, as clue number 1 leads to the situation a year and a
- half ago, when Tim was 1 1/2, Jane was 6 1/2, and Mary was 13 1/2.
-
- This sort of problem is easy if you write down a set of equations. Let
- t be the year that Tim was born, j be the year that Jane was born, m be
- the year that Mary was born, and y be the current year. As indefinite
- years come up, let y1, y2, ... be the indefinite years. Then the
- equations are
-
-
- y + 10 - t = 2 (y1 - j)
- y1 - m = 9 (y1 - t)
-
- y - 8 - m = 1/2 (y2 - j)
- y2 - j = 1 + y3 - t
- y3 - m = 5 (y + 2 - t)
-
- t + 1 - m = 3 + y4 - t
- y4 - j = 3 (y5 - 6 - m)
- y5 - j = 1/2 (y6 - t)
- y6 - m = 10 + y7 - m
- y7 - j = 1/3 (y8 - t)
- y8 - m = 3 (j - m)
-
- t = y - 3
- j = y - 8
- m = y - 15
-
- ==> logic/bookworm.p <==
- A bookworm eats from the first page of an encyclopedia to the last page.
- The bookworm eats in a straight line. The encyclopedia consists of ten
- 1000-page volumes. Not counting covers, title pages, etc., how many pages
- does the bookworm eat through?
-
- ==> logic/bookworm.s <==
- On a book shelf the first page of the first volume is on the "inside"
- __ __
- B| | | |F
- A|1 |...........................|10|R
- C| | | |O
- K| | | |N
- | | | |T
- ----------------------------------
- so the bookworm eats only through the cover of the first volume, then 8 times
- 1000 pages of Volumes 2 - 9, then through the cover to the 1st page of Vol 10.
- He eats 8,000 pages.
-
- ==> logic/boxes.p <==
- Which Box Contains the Gold?
-
- Two boxes are labeled "A" and "B". A sign on box A says "The sign
- on box B is true and the gold is in box A". A sign on box B says
- "The sign on box A is false and the gold is in box A". Assuming there
- is gold in one of the boxes, which box contains the gold?
-
- ==> logic/boxes.s <==
- The problem cannot be solved with the information given.
-
- The sign on box A says "The sign on box B is true and the gold is in box A".
- The sign on box B says "The sign on box A is false and the gold is in box A".
- The following argument can be made: If the statement on box A is true, then
- the statement on box B is true, since that is what the statement on box A
- says. But the statement on box B states that the statement on box A is false,
- which contradicts the original assumption. Therefore, the statement on box A
- must be false. This implies that either the statement on box B is false or
- that the gold is in box B. If the statement on box B is false, then either
- the statement on box A is true (which it cannot be) or the gold is in box B.
- Either way, the gold is in box B.
-
- However, there is a hidden assumption in this argument: namely, that
- each statement must be either true or false. This assumption leads to
- paradoxes, for example, consider the statement: "This statement is
- false." If it is true, it is false; if it is false, it is true. The
- only way out of the paradox is to deny that the statement is either true
- or false and label it meaningless instead. Both of the statements on the
- boxes are therefore meaningless and nothing can be concluded from them.
-
- In general, statements about the truth of other statements lead to
- contradictions. Tarski invented metalanguages to avoid this problem.
- To avoid paradox, a statement about the truth of a statement in a language
- must be made in the metalanguage of the language.
-
- Common sense dictates that this problem cannot be solved with the information
- given. After all, how can we deduce which box contains the gold simply by
- reading statements written on the outside of the box? Suppose we deduce that
- the gold is in box B by whatever line of reasoning we choose. What is to stop
- us from simply putting the gold in box A, regardless of what we deduced?
- (cf. Smullyan, "What Is the Name of This Book?", Prentice-Hall, 1978, #70)
-
- ==> logic/calibans.will.p <==
- ----------------------------------------------
- | Caliban's Will by M.H. Newman |
- ----------------------------------------------
-
- When Caliban's will was opened it was found to contain the following
- clause:
-
- "I leave ten of my books to each of Low, Y.Y., and 'Critic,' who are
- to choose in a certain order.
-
- No person who has seen me in a green tie is to choose before Low.
-
- If Y.Y. was not in Oxford in 1920 the first chooser never lent me
- an umbrella.
-
- If Y.Y. or 'Critic' has second choice, 'Critic' comes before the one
- who first fell in love."
-
- Unfortunately Low, Y.Y., and 'Critic' could not remember any of the
- relevant facts; but the family solicitor pointed out that, assuming the
- problem to be properly constructed (i.e. assuming it to contain no
- statement superfluous to its solution) the relevant data and order
- could be inferred.
-
- What was the prescribed order of choosing; and who lent Caliban an
- umbrella?
-
- ==> logic/calibans.will.s <==
- Let T be "person who saw Caliban in a green tie."
- Let U be "person who lent Caliban an umbrella."
- Then the data are:
- (1) No T chooses before Low.
- (2) Either Y.Y. was in Oxford in March 1920 or the first chooser is not
- a U.
- (3) Either Low is second or Critic is not last.
-
- Consider first (3)
- If it could be shown that Low is first, then from (3), Critic is not
- last and therefore is second; i.e. the order is Low, Critic, Y.Y.
-
- Next (1)
- If both Critic and Y.Y. were T's would require Low first and (3) then
- gives the order Low-Critic-Y.Y., ie. (2) would be superfluous. Hence
- Critic and Y.Y. are not both T's.
-
- If neither Critic nor Y.Y. were a T, (1) would be trivially true for
- any ordering and therefore would give no information, i.e. would be
- superfluous. Hence just one of Y.Y. and Critic is a T. It follows
- that the only possible order in which Low is not first is:
-
- Not T, Low, T
-
- Now (2)
- First if Y.Y was in Oxford in March 1920, nothing follows from (2)
- about the order and (2) is superfluous. Hence Y.Y. was not in Oxford.
- If Low were a U he would not, by (2) come first, and so by (1) the
- order would be:
-
- Not T, Low, T
-
- i.e. (1) and (2) alone would fix an order, and (3) would be superfluous.
- Hence Low is not a U.
-
- It now follows, by the arguments just given for T's under (1) that just
- one of Y.Y. and Critic is a U. If the same one is the T and the U (2)
- follows from (1) (since Low is not a U); i.e (2) is superfluous. The
- situation is therefore:
- T's: just one of Y.Y. and Critic; not Low
- U's: the other one of Y.Y; not Low
- It now follows that "not T, Low, T" is impossible, for the "not T" is
- the "U" and therefore, by (2), is not first. Hence Low is first, and
- (3) gives the order:
- Low, Critic, Y.Y.
-
- Finally, Y.Y. is a T, and Critic is a U. For if Critic is a T, then
- by (1) Low precedes Critic and hence (3) allows only "Low, Critic, Y.Y";
- (2) is superfluous. I.e. Critic (only) lent Caliban an umbrella.
-
- The problem is from _Problems Omnibus_ by Hubert Phillips,
- Arco Publications, London, 1960. Hubert Phillips was a noted puzzelist
- who contributed under his own name and the pseudonyms of "Caliban",
- "T.O. Hare", and "The Doc".
-
- ==> logic/camel.p <==
- An Arab sheikh tells his two sons that are to race their camels to a
- distant city to see who will inherit his fortune. The one whose camel
- is slower will win. The brothers, after wandering aimlessly for days,
- ask a wiseman for advise. After hearing the advice they jump on the
- camels and race as fast as they can to the city. What did the wiseman
- say?
-
- ==> logic/camel.s <==
- The wiseman tells them to switch camels.
-
- ==> logic/centrifuge.p <==
- You are a biochemist, working with a 12-slot centrifuge. This is a gadget
- that has 12 equally spaced slots around a central axis, in which you can
- place chemical samples you want centrifuged. When the machine is turned on,
- the samples whirl around the central axis and do their thing.
-
- To ensure that the samples are evenly mixed, they must be distributed in the
- 12 slots such that the centrifuge is balanced evenly. For example, if you
- wanted to mix 4 samples, you could place them in slots 12, 3, 6 and 9
- (assuming the slots are numbered from 1 to 12 like a clock).
-
- Problem: Can you use the centrifuge to mix 5 samples?
-
- ==> logic/centrifuge.s <==
- The superposition of any two solutions is yet another solution, so given
- that the factors > 1 of 12 (2, 3, 4, 6, 12) are all solutions, the
- only thing to check about, for example, the proposed solution 2+3 is
- that not all ways of combining 2 & 3 would have centrifuge tubes
- from one subsolution occupying the slot for one of the tubes in
- another solution. For the case 2+3, there is no problem: Place 3
- tubes, one in every 4th position, then place the 4th and 5th
- diametrically opposed (each will end up in a slot adjacent to one of
- the first 3 tubes). The obvious generalization is, what are the
- numbers of tubes that cannot be balanced? Observing that there are
- solutions for 2,3,4,5,6 tubes and that if X has a solution, 12-X has
- also one (obtained by swapping tubes and holes), it is obvious that
- 1 and 11 are the only cases without solutions.
-
- Here is how this problem is often solved in practice: A dummy tube
- is added to produce a total number of tubes that is easy to balance.
- For example, if you had to centrifuge just one sample, you'd add a
- second tube opposite it for balance.
-
- ==> logic/children.p <==
- A man walks into a bar, orders a drink, and starts chatting with the
- bartender. After a while, he learns that the bartender has three
- children. "How old are your children?" he asks. "Well," replies the
- bartender, "the product of their ages is 72." The man thinks for a
- moment and then says, "that's not enough information." "All right,"
- continues the bartender, "if you go outside and look at the building
- number posted over the door to the bar, you'll see the sum of the
- ages." The man steps outside, and after a few moments he reenters and
- declares, "Still not enough!" The bartender smiles and says, "My
- youngest just loves strawberry ice cream."
-
- How old are the children?
-
- A variant of the problem is for the sum of the ages to be 13 and the
- product of the ages to be the number posted over the door. In this
- case, it is the oldest that loves ice cream.
-
- Then how old are they?
-
-
- ==> logic/children.s <==
- First, determine all the ways that three ages can multiply together to get 72:
-
- 72 1 1 (quite a feat for the bartender)
- 36 2 1
- 24 3 1
- 18 4 1
- 18 2 2
- 12 6 1
- 12 3 2
- 9 4 2
- 9 8 1
- 8 3 3
- 6 6 2
- 6 4 3
-
- As the man says, that's not enough information; there are many possibilities.
- So the bartender tells him where to find the sum of the ages--the man now knows
- the sum even though we don't. Yet he still insists that there isn't enough
- info. This must mean that there are two permutations with the same sum;
- otherwise the man could have easily deduced the ages.
-
- The only pair of permutations with the same sum are 8 3 3 and 6 6 2, which both
- add up to 14 (the bar's address). Now the bartender mentions his
- "youngest"--telling us that there is one child who is younger than the other
- two. This is impossible with 8 3 3--there are two 3 year olds. Therefore the
- ages of the children are 6, 6, and 2.
-
- Pedants have objected that the problem is insoluble because there could be
- a youngest between two three year olds (even twins are not born exactly at
- the same time). However, the word "age" is frequently used to denote the
- number of years since birth. For example, I am the same age as my wife,
- even though technically she is a few months older than I am. And using the
- word "youngest" to mean "of lesser age" is also in keeping with common parlance.
- So I think the solution is fine as stated.
-
- In the sum-13 variant, the possibilities are:
-
- 11 1 1
- 10 2 1
- 9 3 1
- 9 2 2
- 8 4 1
- 8 3 2
- 7 5 1
- 7 4 2
- 7 3 3
- 6 6 1
- 6 5 2
- 6 4 3
-
- The two that remain are 9 2 2 and 6 6 1 (both products equal 36). The
- final bit of info (oldest child) indicates that there is only one
- child with the highest age. This cancels out the 6 6 1 combination, leaving
- the childern with ages of 9, 2, and 2.
-
- ==> logic/condoms.p <==
- How can you have mutually safe sex with three women with only two condoms?
-
- ==> logic/condoms.s <==
- Use both condoms on the first woman. Take off the outer condom (turning it
- inside-out in the process) and set it aside. Use the inner condom alone on
- the second woman. Put the outer condom back on. Use it on the third woman.
-
- ==> logic/dell.p <==
- How can I solve logic puzzles (e.g., as published by Dell) automatically?
-
- ==> logic/dell.s <==
- #include <setjmp.h>
-
- #define EITHER if (S[1] = S[0], ! setjmp((S++)->jb)) {
- #define OR } else EITHER
- #define REJECT longjmp((--S)->jb, 1)
- #define END_EITHER } else REJECT;
-
- /* values in tmat: */
- #define T_UNK 0
- #define T_YES 1
- #define T_NO 2
-
- #define Val(t1,t2) (S->tmat[t1][t2])
- #define CLASS(x) \
- (((x) / NUM_ITEM) * NUM_ITEM)
- #define EVERY_TOKEN(x) \
- (x = 0; x < TOT_TOKEN; x++)
- #define EVERY_ITEM(x, class) \
- (x = CLASS(class); x < CLASS(class) + NUM_ITEM; x++)
-
- #define BEGIN \
- struct state { \
- char tmat[TOT_TOKEN][TOT_TOKEN]; \
- jmp_buf jb; \
- } States[100], *S = States; \
- \
- main() \
- { \
- int token; \
- \
- for EVERY_TOKEN(token) \
- yes(token, token); \
- EITHER
-
- /* Here is the problem-specific data */
- #define NUM_ITEM 5
- #define NUM_CLASS 6
- #define TOT_TOKEN (NUM_ITEM * NUM_CLASS)
-
- #define HOUSE_0 0
- #define HOUSE_1 1
- #define HOUSE_2 2
- #define HOUSE_3 3
- #define HOUSE_4 4
-
- #define ENGLISH 5
- #define SPANISH 6
- #define NORWEG 7
- #define UKRAIN 8
- #define JAPAN 9
-
- #define GREEN 10
- #define RED 11
- #define IVORY 12
- #define YELLOW 13
- #define BLUE 14
-
- #define COFFEE 15
- #define TEA 16
- #define MILK 17
- #define OJUICE 18
- #define WATER 19
-
- #define DOG 20
- #define SNAIL 21
- #define FOX 22
- #define HORSE 23
- #define ZEBRA 24
-
- #define OGOLD 25
- #define PLAYER 26
- #define CHESTER 27
- #define LSTRIKE 28
- #define PARLIA 29
-
- char *names[] = {
- "HOUSE_0", "HOUSE_1", "HOUSE_2", "HOUSE_3", "HOUSE_4",
- "ENGLISH", "SPANISH", "NORWEG", "UKRAIN", "JAPAN",
- "GREEN", "RED", "IVORY", "YELLOW", "BLUE",
- "COFFEE", "TEA", "MILK", "OJUICE", "WATER",
- "DOG", "SNAIL", "FOX", "HORSE", "ZEBRA",
- "OGOLD", "PLAYER", "CHESTER", "LSTRIKE", "PARLIA",
- };
-
- BEGIN
-
- yes(ENGLISH, RED); /* Clue 1 */
- yes(SPANISH, DOG); /* Clue 2 */
- yes(COFFEE, GREEN); /* Clue 3 */
- yes(UKRAIN, TEA); /* Clue 4 */
-
- EITHER /* Clue 5 */
- yes(IVORY, HOUSE_0);
- yes(GREEN, HOUSE_1);
- OR
- yes(IVORY, HOUSE_1);
- yes(GREEN, HOUSE_2);
- OR
- yes(IVORY, HOUSE_2);
- yes(GREEN, HOUSE_3);
- OR
- yes(IVORY, HOUSE_3);
- yes(GREEN, HOUSE_4);
- END_EITHER
-
- yes(OGOLD, SNAIL); /* Clue 6 */
- yes(PLAYER, YELLOW); /* Clue 7 */
- yes(MILK, HOUSE_2); /* Clue 8 */
- yes(NORWEG, HOUSE_0); /* Clue 9 */
-
- EITHER /* Clue 10 */
- yes(CHESTER, HOUSE_0);
- yes(FOX, HOUSE_1);
- OR
- yes(CHESTER, HOUSE_4);
- yes(FOX, HOUSE_3);
- OR
- yes(CHESTER, HOUSE_1);
- EITHER yes(FOX, HOUSE_0);
- OR yes(FOX, HOUSE_2);
- END_EITHER
- OR
- yes(CHESTER, HOUSE_2);
- EITHER yes(FOX, HOUSE_1);
- OR yes(FOX, HOUSE_3);
- END_EITHER
- OR
- yes(CHESTER, HOUSE_3);
- EITHER yes(FOX, HOUSE_2);
- OR yes(FOX, HOUSE_4);
- END_EITHER
- END_EITHER
-
- EITHER /* Clue 11 */
- yes(PLAYER, HOUSE_0);
- yes(HORSE, HOUSE_1);
- OR
- yes(PLAYER, HOUSE_4);
- yes(HORSE, HOUSE_3);
- OR
- yes(PLAYER, HOUSE_1);
- EITHER yes(HORSE, HOUSE_0);
- OR yes(HORSE, HOUSE_2);
- END_EITHER
- OR
- yes(PLAYER, HOUSE_2);
- EITHER yes(HORSE, HOUSE_1);
- OR yes(HORSE, HOUSE_3);
- END_EITHER
- OR
- yes(PLAYER, HOUSE_3);
- EITHER yes(HORSE, HOUSE_2);
- OR yes(HORSE, HOUSE_4);
- END_EITHER
- END_EITHER
-
- yes(LSTRIKE, OJUICE); /* Clue 12 */
- yes(JAPAN, PARLIA); /* Clue 13 */
-
- EITHER /* Clue 14 */
- yes(NORWEG, HOUSE_0);
- yes(BLUE, HOUSE_1);
- OR
- yes(NORWEG, HOUSE_4);
- yes(BLUE, HOUSE_3);
- OR
- yes(NORWEG, HOUSE_1);
- EITHER yes(BLUE, HOUSE_0);
- OR yes(BLUE, HOUSE_2);
- END_EITHER
- OR
- yes(NORWEG, HOUSE_2);
- EITHER yes(BLUE, HOUSE_1);
- OR yes(BLUE, HOUSE_3);
- END_EITHER
- OR
- yes(NORWEG, HOUSE_3);
- EITHER yes(BLUE, HOUSE_2);
- OR yes(BLUE, HOUSE_4);
- END_EITHER
- END_EITHER
-
- /* End of problem-specific data */
-
- solveit();
- OR
- printf("All solutions found\n");
- exit(0);
- END_EITHER
- }
-
- no(a1, a2)
- {
- int non1, non2, token;
-
- if (Val(a1, a2) == T_YES)
- REJECT;
- else if (Val(a1, a2) == T_UNK) {
- Val(a1, a2) = T_NO;
- no(a2, a1);
- non1 = non2 = -1;
-
- for EVERY_ITEM(token, a1)
- if (Val(token, a2) != T_NO)
- if (non1 == -1)
- non1 = token;
- else
- break;
- if (non1 == -1)
- REJECT;
- else if (token == CLASS(a1) + NUM_ITEM)
- yes(non1, a2);
-
- for EVERY_TOKEN(token)
- if (Val(token, a1) == T_YES)
- no(a2, token);
- }
- }
-
- yes(a1, a2)
- {
- int token;
-
- if (Val(a1, a2) == T_NO)
- REJECT;
- else if (Val(a1, a2) == T_UNK) {
- Val(a1, a2) = T_YES;
- yes(a2, a1);
- for EVERY_ITEM(token, a1)
- if (token != a1)
- no(token, a2);
- for EVERY_TOKEN(token)
- if (Val(token, a1) == T_YES)
- yes(a2, token);
- else if (Val(token, a1) == T_NO)
- no(a2, token);
- }
- }
-
- solveit()
- {
- int token, tok2;
-
- for EVERY_TOKEN(token)
- for (tok2 = token; tok2 < TOT_TOKEN; tok2++)
- if (Val(token, tok2) == T_UNK) {
- EITHER
- yes(token, tok2);
- OR
- no(token, tok2);
- END_EITHER;
- return solveit();
- }
- printf("Solution:\n");
- for EVERY_ITEM(token, 0) {
- for (tok2 = NUM_ITEM; tok2 < TOT_TOKEN; tok2++)
- if (Val(token, tok2) == T_YES)
- printf("\t%s %s\n",names[token],names[tok2]);
- printf("\n");
- }
- REJECT;
- }
-
- ---
- james@crc.ricoh.com (James Allen)
-
- ==> logic/elimination.p <==
- 97 baseball teams participate in an annual state tournament.
- The way the champion is chosen for this tournament is by the same old
- elimination schedule. That is, the 97 teams are to be divided into
- pairs, and the two teams of each pair play against each other.
- After a team is eliminated from each pair, the winners would
- be again divided into pairs, etc. How many games must be played
- to determine a champion?
-
- ==> logic/elimination.s <==
- In order to determine a winner all but one team must lose.
- Therefore there must be at least 96 games.
-
- ==> logic/family.p <==
- Suppose that it is equally likely for a pregnancy to deliver
- a baby boy as it is to deliver a baby girl. Suppose that for a
- large society of people, every family continues to have children
- until they have a boy, then they stop having children.
- After 1,000 generations of families, what is the ratio of males
- to females?
-
- ==> logic/family.s <==
- The ratio will be 50-50 in both cases. We are not killing off any
- fetuses or babies, and half of all conceptions will be male, half
- female. When a family decides to stop does not affect this fact.
-
- ==> logic/flip.p <==
- How can a toss be called over the phone (without requiring trust)?
-
- ==> logic/flip.s <==
- A flips a coin. If the result is heads, A multiplies 2 90-digit prime
- numbers; if the result is tails, A multiplies 3 60-digit prime
- numbers. A tells B the result of the multiplication. B now calls
- either heads or tails and tells A. A then supplies B with the
- original numbers to verify the flip.
-
- ==> logic/friends.p <==
- Any group of 6 or more contains either 3 mutual friends or 3 mutual strangers.
- Prove it.
-
- ==> logic/friends.s <==
- Take a person X. Of the five other people, there must either be at least three
- acquaintances of X or at least three strangers of X. Assume wlog that X has
- three strangers A,B,C. Unless A,B,C is the required triad of acquaintances,
- they must include a pair of strangers, wlog A,B. Then X,A,B is the required
- triad of strangers, QED.
-
- ==> logic/hundred.p <==
- A sheet of paper has statements numbered from 1 to 100. Statement n says
- "exactly n of the statements on this sheet are false." Which statements are
- true and which are false? What if we replace "exactly" by "at least"?
-
- ==> logic/hundred.s <==
- It is tempting to argue as follows:
-
- Since only one statement can be true (they are mutually contradictory),
- therefore 99 are false. So, all are false except for statement 99.
-
- If replaced by "at least", and the "real" number of false statements is
- x, then statements x+1 to 100 will be false (since they falsely claim
- that there are more false statements than there actually are). So, 100-x are
- false, ie. x=100-x, so x=50. The first 50 statements are true, and statements
- 51 to 100 are false.
-
- However, there is a hidden and incorrect assumption in this argument.
- To see this, suppose that there is one statement on the sheet and it
- says "One statement is false" or "At least one statement is false,"
- either way it implies "this statement is false," which is a familiar
- paradoxical statement. We have learned that this paradox arises because
- of the false assumption that all statements are either true or false.
- This is the hidden assumption in the above reasoning.
-
- If it is acknowledged that some of the statements on the page may be
- neither true nor false (i.e., meaningless), then nothing whatsoever can
- be concluded about which statements are true or false.
-
- This problem has been carefully contrived to appear to be solvable (like
- the vacuous statement "this statement is true"). By changing the
- numbers in some statements and changing "true" to "false," various
- circular forms of the liar's paradox can be constructed.
-
- From _Litton's Problematical Recreations_
-
- ==> logic/inverter.p <==
- Can a digital logic circuit with two inverters invert N independent inputs?
- The circuit may contain any number of AND or OR gates.
-
- ==> logic/inverter.s <==
- It can be shown that N inverters can invert 2N-1 independent inputs, given
- an unlimited supply of AND and OR gates. The classic version of this
- puzzle is to invert 3 independent inputs using AND gates, OR gates, and
- only 2 inverters.
-
- So, start with N inverters. Replace 3 of them with 2.
- Keep doing that until you're down to 2 inverters.
-
- I was skeptical at first, because such a design requires so much feedback
- that I was sure the system would oscillate when switching between two
- particular states. But after writing a program to test every possible state
- change (32^2), it appears that this system settles after a maximum of
- 3 feedback logic iterations. I did not include gate delays in the simulation,
- however, which could increase the number of iterations before the system
- settles.
-
- In any case, it appears that the world needs only 2 inverters! :-)
-
- ==> logic/josephine.p <==
- The recent expedition to the lost city of Atlantis discovered scrolls
- attributted to the great poet, scholar, philosopher Josephine. They
- number eight in all, and here is the first.
-
- THE KINGDOM OF MAMAJORCA, WAS RULED BY QUEEN HENRIETTA I. IN MAMAJORCA
- WOMEN HAVE TO PASS AN EXTENSIVE LOGIC EXAM BEFORE THEY ARE ALLOWED TO
- GET MARRIED. QUEENS DO NOT HAVE TO TAKE THIS EXAM. ALL THE WOMEN IN
- MAMAJORCA ARE LOYAL TO THEIR QUEEN AND DO WHATEVER SHE TELLS THEM TO.
- THE QUEENS OF MAMAJORCA ARE TRUTHFUL. ALL SHOTS FIRED IN MAMAJORCA CAN
- BE HEARD IN EVERY HOUSE. ALL ABOVE FACTS ARE KNOWN TO BE COMMON
- KNOWLEDGE.
-
- HENRIETTA WAS WORRIED ABOUT THE INFIDELITY OF THE MARRIED MEN IN
- MAMAJORCA. SHE SUMMONED ALL THE WIVES TO THE TOWN SQUARE, AND MADE
- THE FOLLOWING ANNOUNCEMENT. "THERE IS AT LEAST ONE UNFAITHFUL HUSBAND
- IN MAMAJORCA. ALL WIVES KNOW WHICH HUSBANDS ARE UNFAITHFUL, BUT HAVE
- NO KNOWLEDGE ABOUT THE FIDELITY OF THEIR OWN HUSBAND. YOU ARE
- FORBIDDEN TO DISCUSS YOUR HUSBAND'S FAITHFULNESS WITH ANY OTHER WOMAN.
- IF YOU DISCOVER THAT YOUR HUSBAND IS UNFAITHFUL, YOU MUST SHOOT HIM AT
- PRECISELY MIDNIGHT OF THE DAY YOU FIND THAT OUT."
-
- THIRTY-NINE SILENT NIGHTS FOLLOWED THE QUEEN'S ANNOUNCEMENT. ON THE
- FORTIETH NIGHT, SHOTS WERE HEARD. QUEEN HENRIETTA I IS REVERED IN
- MAMAJORCAN HISTORY.
-
- As with all philosophers Josephine doesn't provide the question, but leaves
- it implicit in his document. So figure out the questions - there are two -
- and answer them.
-
- Here is Josephine's second scroll.
-
- QUEEN HENRIETTA I WAS SUCCEEDED BY DAUGHTER QUEEN HENRIETTA II. AFTER
- A WHILE HENRIETTA LIKE HER FAMOUS MOTHER BECAME WORRIED ABOUT THE
- INFIDELITY PROBLEM. SHE DECIDED TO ACT, AND SENT A LETTER TO HER
- SUBJECTS (WIVES) THAT CONTAINED THE EXACT WORDS OF HENRIETTA I'S
- FAMOUS SPEECH. SHE ADDED THAT THE LETTERS WERE GUARENTEED TO REACH
- ALL WIVES EVENTUALLY.
-
- QUEEN HENRIETTA II IS REMEMBERED AS A FOOLISH AND UNJUST QUEEN.
-
- What is the question and answer implied by this scroll?
-
- ==> logic/josephine.s <==
- The two questions for scroll #1 were:
-
- 1. How many husbands were shot on that fateful night?
- 2. Why is Queen Henrietta I revered in Mamajorca?
-
- The answers are:
-
- If there are n unfaithful husbands (UHs), every wife of an UH knows of
- n-1 UH's while every wife of a faithful husband knows of n UHs. [this
- because everyone has perfect information about everything except the
- fidelity of their own husband]. Now we do a simple induction: Assume
- that there is only one UH. Then all the wives but one know that there
- is just one UH, but the wife of the UH thinks that everyone is
- faithful. Upon hearing that "there is at least one UH", the wife
- realizes that the only husband it can be is her own, and so shoots
- him. Now, imagine that there are just two UH's. Each wife of an UH
- assumes that the situation is "only one UH in town" and so waits to
- hear the other wife (she knows who it is, of course) shoot her husband
- on the first night. When no one is shot, that can only be because her
- OWN husband was a second UH. The wife of the second UH makes the same
- deduction when no shot is fired the first night (she was waiting, and
- expecting the other to shoot, too). So they both figure it out after
- the first night, and shoot their husbands the second night. It is
- easy to tidy up the induction to show that the n UHs will all be shot
- just on the n'th midnight.
-
- The question for scroll #2 is:
-
- 3. Why is Queen Henrietta II not?
-
- The answer is:
-
- The problem now is that QHII didn't realize that it is *critical* that
- all of the wives, of faithful and UH's alike, to
- *BEGIN*AT*THE*SAME*MOMENT*. The uncertainty of having a particular
- wife's notice come a day or two late makes the whole logic path fall
- apart. That's why she's foolish. She is unjust, because some wives,
- honed and crack logicians all, remember, will *incorrectly* shoot
- faithful husbands. Let us imagine the situation with just a SINGLE UH
- in the whole country. And, wouldn't you know it, the notice to the
- wife of the UH just happens to be held up a day, whereas everyone
- else's arrived the first day. Now, all of the wives that got the
- notice the first day know that there is just one UH in the country.
- And they know that the wife of that UH will think that everyone is
- faithful, and so they'll expect her to figure it out and shoot her
- husband the first night. BUT SHE DIDN"T GET THE NOTICE THE FIRST
- NIGHT.... BUT THE OTHER WIVES HAVE NO WAY OF KNOWING THAT. So, the
- wife of the UH doesn't know that anything is going on and so (of
- course) doesn't do anything the first night. The next day she gets
- the notice, figures it all out, and her husband will be history come
- that midnight. BUT... *every* other wife thought that there should
- have been a shooting the first night, and since there wasn't there
- must have been an additional UH, and it can only have been _her_
- husband. So on the second night **ALL** of the husbands are shot.
- Things are much more complicated if the mix of who gets the notice
- when is less simple than the one I mentioned above, but it is always
- wrong and/or tragic.
-
- NOTE: if the wives *know* that the country courier service (or however
- these things get delivered) is flaky, then they can avoid the
- massacre, but unless the wives exchange notes no one will ever be shot
- (since there is always a chance that rather than _your_ husband being
- an UH, you could reason that it might be that the wife of one of the
- UH's that you know about just hasn't gotten her copy of the scroll
- yet). I guess you could call this case "unjust", too, since the UH's
- evade punishment, despite the perfect logic of the wives.
-